<?php 
require_once('Xml/Abstract.php');

class Xml_Rss extends Xml_Abstract {
    protected function _header($_aryData) {
        return <<<RSS
            <rss version="2.0">
            <channel>
                <title>{$_aryData['title']}</title>
                <link>{$_aryData['link']}</link>
                <description>{$_aryData['description']}</description>
                <pubDate>{$_aryData['pubDate']}</pubDate>
                <copyright>{$_aryData['copyright']}</copyright>
                <webMaster>{$_aryData['webMaster']}</webMaster>
                <language>{$_aryData['language']}</language>
                <docs>{$_aryData['doc']}</docs>
                <ttl>10</ttl>
RSS;
    }

    protected function _footer($_aryInfo) {
        return <<<RSS
            </channel>
            </rss>
RSS;
    }

    protected function _items($_aryData) {
       $_content = '';
       foreach($_aryData as $_data) {
           $_content .= <<<RSS
                <item>
                    <title>{$_data['title']}</title>
                    <link>{$_data['link']}</link>
                    <pubDate>{$_data['pubDate']}</pubDate>
                    <description>
                        <![CDATA[<img src="{$_data['img']}-x125.jpg"/>{$_data['content']}]]>
                    </description>
                </item>
RSS;
       }
       return $_content;
    }

    /**
     * @see Xml_Abstract::getFileName()
     */
    public function getFileName() {
        return 'sitemap.xml';
    }
}
